let new_foo a =
    object(self)
        method a = a
    end;;

let obj = ref (new_foo 0);;

let rec loop i j =
    obj := new_foo i;
 	if (i < j) then
        loop (i + 1) j;;

loop 0 1000000;;

print_int !obj#a;;
print_string "\n";;
